package com.qunar.crawler.utils;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @author waynechen Jun 5, 2012 11:03:16 AM
 */
public class DateUtils {

	/**
	 * 传入 格式 9:10:3<br>
	 * 将得到一个对应的Date对象
	 * 
	 * @author waynechen
	 * @param HH_mm_ss
	 * @return
	 * @throws ParseException
	 */
	public static Date composeTimeOfToday(String HH_mm_ss) throws ParseException {
		final SimpleDateFormat yyyy_MM_dd = new SimpleDateFormat("yyyy-MM-dd");
		final SimpleDateFormat yyyy_MM_dd_HH_mm_ss = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		Date date = new Date();
		String format = yyyy_MM_dd.format(date);
		date = yyyy_MM_dd_HH_mm_ss.parse(format + " " + HH_mm_ss);
		return date;
	}
}

//Calendar cal = Calendar.getInstance();
//int year = cal.get(Calendar.YEAR);
//System.out.println("Current Year: " + year);
//int yea1r = cal.get(Calendar.MONTH) + 1;
//System.out.println("Current Year: " + yea1r);
//int yea2r = cal.get(Calendar.DATE);
//System.out.println("Current Year: " + yea2r);